import { Column, DeleteDateColumn, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("user_role", { schema: "small_tail_admin" })
export class UserRole {
  @PrimaryGeneratedColumn({ type: "int", name: "id", comment: "主键 ID" })
  id: number;

  @Column("int", { name: "user_id", comment: "用户 ID" })
  userId: number;

  @Column("int", { name: "role_id", comment: "角色 ID" })
  roleId: number;

  @Column("tinyint", {
    name: "deleted",
    comment: "是否删除",
    width: 1,
    default: () => "'0'",
  })
  deleted: boolean;

  @Column("datetime", {
    name: "create_time",
    comment: "创建时间",
    default: () => "CURRENT_TIMESTAMP",
  })
  createTime: Date;

  @Column("datetime", {
    name: "update_time",
    comment: "更新时间",
    default: () => "CURRENT_TIMESTAMP",
  })
  updateTime: Date;

  @DeleteDateColumn({
    type: "datetime",
    name: "delete_time",
    nullable: true,
    comment: "删除时间",
  })
  deleteTime: Date | null;
}
